package com.das.mechanic_base.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.bumptech.glide.Glide;
import com.das.mechanic_base.R;
import com.das.mechanic_base.utils.X3ScreenUtils;

/**
 * Created by chensi on 2018/3/29.
 */

public class X3LoadingDialog {

    public static Dialog createLoadingDialog(Context context, String msg) {

        View v = LayoutInflater.from(context).inflate(R.layout.x3_load_bar_dialog, new RelativeLayout(context),false);// 得到加载view
        ImageView iv_loading = v.findViewById(R.id.iv_loading);
        Glide.with(context).asGif().load(R.drawable.x3_loading).into(iv_loading);

        Dialog loadingDialog = new Dialog(context, R.style.loadingDialog);// 创建自定义样式dialog

        loadingDialog.setCancelable(true);// 不可以用“返回键”取消
        loadingDialog.setContentView(v, new RelativeLayout.LayoutParams(
                X3ScreenUtils.dipToPx(120,context),
                X3ScreenUtils.dipToPx(120,context)));// 设置布局
        return loadingDialog;
    }

}
